﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace Sueetie.Web
{
    public partial class HomeMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MembershipUser user = Membership.GetUser();

                AdminLink.NavigateUrl = "/admin/default.aspx";
                if (!Page.User.IsInRole("SueetieAdministrator"))
                {
                    AdminLI.Visible = false;
                    AdminLink.Visible = false;
                }
                UserLink.Text = "Welcome, Guest!";
                UserLink.NavigateUrl = "/members/login.aspx";
                if (Page.User.Identity.IsAuthenticated)
                {
                    UserLink.Text = "Welcome, " + user.UserName + "!";
                    UserLink.NavigateUrl = "/members/myaccountinfo.aspx";
                }
                if (Page.User.Identity.IsAuthenticated)
                    RegisterLI.Visible = false;

            }
        }
    }
}
